/**
 *  设备相关接口
 * **/

import request from '@/common/request.js'
import {
	HTTP_REQUEST_URL,
	HTTP_OLD_HOST,
	HTTP_CAMERA_URL,
	WEB_HOST,
	HTTP_CAMERA_URL_1
} from '@/config.js'

const tool_api = {}



// 获取设备状态
tool_api.checkDevState = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/report.do',
	data: data
})

// 获取设备类型列表
tool_api.getDeviceType = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/device-type.do',
	data: data
})

// 获取设备列表
tool_api.getDeviceList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/one-type-list.do',
	data: data
})


// 设备出厂
tool_api.deviceEntry = data => request.uploadFile({
	url: HTTP_REQUEST_URL + '/report/erweima.do',
	filePath: data.filePath,
	name: data.name,
	data: data.formData
})

// // 设备出厂
// tool_api.deviceSave = data => request.globalRequest({
// 	methods: 'POST',
// 	url: HTTP_REQUEST_URL+'/report/erweima.do',   
// 	data: data   
// })

// 设备安装
// tool_api.deviceInstall = data => request.uploadFile({
// 	url: HTTP_REQUEST_URL + '/report/update-erweima.do',
// 	filePath: data.filePath,
// 	name: data.name,
// 	data: data.formData
// })

//设备安装
// 在设备安装完成后  后台再次修改设备状态为安装 此时后台已有该设备安装照片 不上传新的安装照片 filePath为空
tool_api.deviceInstall = function(data) {
	if (data.filePath) {
		return request.uploadFile({
			url: HTTP_REQUEST_URL + '/report/update-erweima.do',
			filePath: data.filePath,
			name: data.name,
			data: data.formData
		})
	} else {
		return request.globalRequest({
			methods: 'POST',
			url: HTTP_REQUEST_URL + '/report/update-erweima.do',
			data: data.formData
		})
	}
}

// 已安装设备
tool_api.yazDevice = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/yazdevice.do',
	data: data
})



// 上报维修
tool_api.upReportInfo = data => request.uploadFile({
	url: HTTP_REQUEST_URL + '/report/up-report-info.do',
	filePath: data.filePath,
	name: data.name,
	data: data.formData
})

// 售后维修
tool_api.upRepairsInfo = data => request.uploadFile({
	url: HTTP_REQUEST_URL + '/report/up-repairs-info.do',
	filePath: data.filePath,
	name: data.name,
	data: data.formData
})

// 售后维护详情
tool_api.repairsInfoDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/one-repairs-info.do',
	data: data
})

// 售后维修详情
tool_api.reportInfoDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/one-report-info.do',
	data: data
})

// 设备故障列表
tool_api.reportWhylist = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/whylist.do',
	data: data
})






// 设备型号
tool_api.getDevNumber = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/modelnumber.do',
	data: data
})

// 设备详情
tool_api.getDevInfo = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/devinfo.do',
	data: data
})

// 设备维修记录
tool_api.getListReportInfo = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/list-report-info.do',
	data: data
})

// 设备售后维修记录
tool_api.getListRepairsInfo = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/list-repairs-info.do',
	data: data
})

// 设备故障详情
tool_api.getOneReportInfo = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/one-report-info.do',
	data: data
})

// 设备故障详情
tool_api.getOneRepairsInfo = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/report/one-repairs-info.do',
	data: data
})

// 设备列表
tool_api.getDataList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/datalist.do',
	data: data
})

// 设备类型
tool_api.getDevType = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/list.do',
	data: data
})

// 设备数量
tool_api.getDevTypeCount = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/typecount.do',
	data: data
})

// 设备状况
tool_api.getDevStatus = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/statustj.do',
	data: data
})



// 性诱虫子
tool_api.getxyPest = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/xy-pest.do',
	data: data
})

// 添加性诱引诱剂
tool_api.addAttractant = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/attractant.do',
	data: data
})

// 性诱引诱剂详情
tool_api.getAttractant = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/yyj.do',
	data: data
})



// 性诱数据
tool_api.getXinYouDataList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/ddatalist.do',
	data: data
})

// 监控设备
tool_api.getJiankonglist = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/jiankong/devicelist.do',
	data: data
})


// 获取虫情监测设备
tool_api.getPestDevList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/devicelist.do',
	data: data
})

// 获取小气候设备列表
tool_api.getXiaoQiHouDevList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/xqh/devicelist.do',
	data: data
})

// 获取小气候设备列表
tool_api.getXingYouWeather = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/newweather.do',
	data: data
})

// 性诱测报一周虫子统计
tool_api.getPestWeekCount = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/weekcount.do',
	data: data
})

// 性诱测报气象走势
tool_api.getWeatherYmdData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/ymd.do',
	data: data
})

// 性诱测报数据统计
tool_api.getXingYouTongJi = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/tongji.do',
	data: data
})

// 性诱测报虫子数据
tool_api.getXingYouPestList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/datadevice/czlist.do',
	data: data
})



// 小气候数据
tool_api.getXiaoQiHouYmd = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/xqh/ymd.do',
	data: data
})

// 杀虫灯 
tool_api.getShaChongDengList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/scd/devicelist.do',
	data: data
})


// 天牛测报总数量 
tool_api.getTianNiuData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/count/tongji.do',
	data: data
})

// 天牛测报虫子列表 
tool_api.getTianNiuPestList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/count/czlist.do',
	data: data
})

// 天牛测报周数据 
tool_api.getTianNiuWeekData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/count/weekcount.do',
	data: data
})


// 全景设备数据 
tool_api.getQuanJingData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/quanjing/onelist.do',
	data: data
})

// 监控数据 
tool_api.getJianKongData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/jiankong/onelist.do',
	data: data
})

// 显示屏数据 
tool_api.getXianShiPingData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/show/list.do',
	data: data
})

// 自动清虫杀虫灯时刻数据
tool_api.getZdqcDevDataList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/zdqc/czlist.do',
	data: data
})

// 自动清虫杀虫时刻详情
tool_api.getZdqcDevTimeDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/zdqc/xq.do',
	data: data
})


// 自动清虫杀虫灯设备管理详情 
tool_api.getZdqcDevManageData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/zdqc/device-setlist.do',
	data: data
})

// 自动清虫杀虫灯设备设置保存 
tool_api.saveZdqcDevManageData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/zdqc/device-set.do',
	data: data
})

// 高空测报灯设置详情 
tool_api.getGaokongDevManageData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/gk/device-setlist.do',
	data: data
})

// 高空测报灯设置详情 
tool_api.saveGaokongDevManageData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/gk/device-set.do',
	data: data
})




// 获取实蝇测报虫子数量 
tool_api.getShiYingDevPestData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/shiying/weekcount.do',
	data: data
})

// 获取实蝇测报气象数据 
tool_api.getShiYingDevWeatherData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/shiying/weather.do',
	data: data
})

// 获取实蝇测报日月周数据 
tool_api.getShiYingDevYmdData = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/shiying/ymd.do',
	data: data
})

// 获取实蝇数量 
tool_api.getShiYingCount = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/shiying/tongji.do',
	data: data
})

// 获取实蝇数量 
tool_api.getShiYingPestlist = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/shiying/czlist.do',
	data: data
})

// 引诱剂管理 
tool_api.getAttractantList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/devices/message.do',
	data: data
})

// 获取虫情虫子列表
tool_api.pestlist = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/pest.do',
	data: data
})

// 设置虫情预警值
tool_api.pestset = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/pest-set.do',
	data: data
})

// 获取虫情监测数据
tool_api.getPestPhotoList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/pest-photo.do',
	data: data
})

// 获取虫情监测虫子数据
tool_api.getPestDataList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/sbpest.do',
	data: data
})

// 获取虫情数据统计
tool_api.getPestTongJi = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/tongji.do',
	data: data
})

// 虫情设备管理详情
tool_api.getDeviceSetDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/device-setlist.do',
	data: data
})

// 保存虫情设备设置
tool_api.saveDeviceSet = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/chongqing/device-set.do',
	data: data
})

// 获取黄板虫情监测数据
tool_api.getHbPestPhotoList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/yellowplate/pest-photo.do',
	data: data
})

// 获取黄板虫情监测虫子数据
tool_api.getHbPestDataList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/yellowplate/sbpest.do',
	data: data
})

// 获取黄板虫情数据统计
tool_api.getHbPestTongJi = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/yellowplate/tongji.do',
	data: data
})

// 虫情设备管理详情
tool_api.getHbDeviceSetDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/yellowplate/device-setlist.do',
	data: data
})

// 保存虫情设备设置
tool_api.saveHbDeviceSet = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/yellowplate/device-set.do',
	data: data
})

// 生态监控设备列表
tool_api.getCameraDev = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_OLD_HOST + '/wxappstjk/devices.do',
	data: data
})

// 生态监控设备列表
tool_api.getCameraDev = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_OLD_HOST + '/wxappstjk/devices.do',
	data: data
})



//获取综合安防key值
tool_api.getJkKey = data => request.globalRequest({
	methods: 'POST',
	url: 'https://wxapi.agri120.org/jiankong/key.do',
	data: data
})

//获取监控token
tool_api.getJkToken = data => request.JkglobalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL_1 + '/api/v1/oauth/token',
	data: data
})

//获取监控token
tool_api.cameraList = data => request.JkglobalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL_1 + '/api/resource/v1/camera/advance/cameraList',
	data: data
})



//获取监控点预览取流URL  http://120.78.185.200:8006/hik-0.0.1-SNAPSHOT/
tool_api.previewURLs = data => request.JkglobalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL_1 + '/api/video/v1/cameras/previewURLs',
	data: data
})

// 连接监控视频 fwq_type==0
tool_api.connectCamera = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL + ':9901/video',
	data: data
})

// 方向控制 fwq_type==0
tool_api.videoControl = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL + ':9901/videoctrl',
	data: data
})

// 方向控制 fwq_type==1
tool_api.videoControl_1 = data => request.JkglobalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL_1 + '/api/video/v1/ptzs/controlling',
	data: data
})



// 取流
tool_api.getCameraLive = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL + ':9901/downlive',
	data: data
})

// 物联网杀虫灯
tool_api.getAllList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_CAMERA_URL + '/scd/alllist.do',
	data: data
})

//孢子仪
//孢子仪曲线图数据
tool_api.getChartSpore = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/spore/chart-spore.do',
	data: data
})
//单个设备数据列表
tool_api.getSporeList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/spore/list.do',
	data: data
})
//单个设备图片数据列表
tool_api.getPhotoList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/spore/photo.do',
	data: data
})


// ===========墒情设备============
//设备列表
tool_api.sq_alllist = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/shangqing/alllist.do',
	data: data
})
//墒情曲线图
tool_api.getSqChart = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/shangqing/chart-spore.do',
	data: data
})
//墒情表格数据
tool_api.getSqList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/shangqing/list.do',
	data: data
})


//性诱拍照
//曲线图
tool_api.getXypzChart = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/xypz/chart-spore.do',
	data: data
})
//表格数据  图片列表
tool_api.getXypzList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/xypz/list.do',
	data: data
})
//获取性诱设备列表
tool_api.getXypzDevList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/xypz/alllist.do',
	data: data
})
//性诱拍照虫子种类
tool_api.getXypzPestList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/xypz/pest.do',
	data: data
})

//YRY-联网杀虫灯  单个设备数据列表
tool_api.getYryList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/yry/list.do',
	data: data
})

//曲线图
tool_api.getYryChart = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/yry/chart-spore.do',
	data: data
})

//设备设置列表
tool_api.getSetList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/yry/device-setlist.do',
	data: data
})

//设置设备列表
tool_api.saveYrySet = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/yry/device-set.do',
	data: data
})


//设备详情页面  删除已上传安装图片
tool_api.delPic = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/report/delimage.do',
	data: data
})

//病情监测仪
tool_api.getBqList = data => request.globalRequest({
	methods: 'POST',
	url: WEB_HOST + '/bingqing/list.do',
	data: data
})

//智能电源控制器 --设备管理
tool_api.getDyDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/power/device-setlist.do',
	data: data
})
tool_api.setDyManage = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/power/device-set.do',
	data: data
})


//智能灌溉 --设备管理
tool_api.getGgDetail = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/irrigate/device-setlist.do',
	data: data
})
tool_api.setGgManage = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/irrigate/device-set.do',
	data: data
})







// 更新城市 （临时）
tool_api.getdingwei = data => request.globalRequest({
	methods: 'POST',
	url: '/test/dingwei.do',
	data: data
})

// 更新城市 （临时）
tool_api.updatedw = data => request.globalRequest({
	methods: 'POST',
	url: '/test/updatedw.do',
	data: data
})


//获取省市区
tool_api.getCities = data => request.globalRequest({
	methods: "POST",
	url: "https://api.honghuoyi.com/yun/area-list",
	data: data
})

// 获取位置详细信息 (高德api)
tool_api.getCityInfo = data => request.globalRequest({
	url: 'https://restapi.amap.com/v3/geocode/regeo',
	data: data,
	methods: "GET"
})





export default tool_api